//
//  SearchView.m
//  iHeima
//
//  Created by he chao on 5/28/14.
//  Copyright (c) 2014 leon. All rights reserved.
//

#import "SearchView.h"

@implementation SearchView
@synthesize field;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        BeeUIImageView *imgBg = [BeeUIImageView spawn];
        imgBg.frame = CGRectMake(0, 0, 320, 45);
        imgBg.contentMode = UIViewContentModeScaleToFill;
        imgBg.image = IMAGESTRING(@"search_bg");
        [self addSubview:imgBg];
        
        field = [BeeUITextField spawn];
        field.frame = CGRectMake(10, 5, 300, 35);
        field.backgroundColor = RGB(244, 244, 244);
        field.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 0)];
        field.leftViewMode = UITextFieldViewModeAlways;
        field.layer.cornerRadius = 3;
        BeeUIButton *btnSearch = [BeeUIButton spawn];
        btnSearch.frame = CGRectMake(0, 0, 35, 30);
        [btnSearch setImage:IMAGESTRING(@"search") forState:UIControlStateNormal];
        field.rightView = btnSearch;
        field.rightViewMode = UITextFieldViewModeAlways;
        [self addSubview:field];
    }
    return self;
}

- (void)setStrPlaceHolder:(NSString *)strPlaceHolder{
    field.placeholder = strPlaceHolder;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
